package com.cwt.sso;

import cn.dev33.satoken.SaManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

/**
 * @author chenwt
 * @version V1.0
 * @describe 【】
 * @date 2023年07月17日 18:13:26
 */
@SpringBootApplication
public class SaSsoServerApplication {

    private static final Logger logger = LoggerFactory.getLogger(SaSsoServerApplication.class);

    public static void main(String[] args) {
        logger.warn("项目开始启动 >> 打印【项目启动完成】后启动成功");
        ConfigurableApplicationContext context = SpringApplication.run(SaSsoServerApplication.class, args);
        Environment environment = context.getEnvironment();
        String path = environment.getProperty("server.servlet.context-path");
        String port = environment.getProperty("server.port");
        logger.info("-----------------------------------------------------------");
        if (StringUtils.isEmpty(path)) {
            path = "";
            logger.info("========== >> boot 访问地址统一前缀：{}", path);
        }
        logger.info("========== >> boot 访问地址：url >> http://{}:{}{}", "localhost", port, path);
        logger.info("========== >> Sa-Token-SSO 认证中心启动成功");
        logger.info("-----------------------------------------------------------");
    }

}
